Graphics or video data is often stored in a frame buffer memory and then continuously read out of the buffer to the display in a scan order. The reading of pixels from the frame buffer to the display is known as display refresh. Typically the frame buffer has its data organized to match the physical organization of the display. Displays usually accept data on a line-by-line basis, starting with the top-left pixel from the first line, then continuing with other pixels in the first line from left to right. Pixels in the second line from the top of the screen are accepted in left-to-right order, and the scanning continues from left to right and from top to bottom.
Sometimes the graphics data needs to be rotated. FIGS. 1A-C show original and rotated graphics data on a display. In FIG. 1A, a display has 80 lines, and each line has 40 display pixels. An image is stored in the frame buffer and displayed in a portrait mode. However, some images may be better displayed to the user by being rotated. For example, a spreadsheet, text article, or image on a web page may be wider than can fit within the 40 pixels per line, causing some of the graphics data to be truncated. by 90 degrees in a clock-wise rotation.
In FIG. 1B, this graphics data has been rotated by 90 degrees so that the graphics data is displayed as 40 lines of 80 pixels per line. In FIG. 1C, the user now has to physically turn the device by −90 degrees (270 degrees) to see the data in a landscape mode.
Of course, the graphics data could be rotated before storage into the frame buffer, such as by a rendering engine or other device that writes the graphics data into the frame buffer. The engine could also read out the frame-buffer data, rotate it, and then write the rotated data back into the frame buffer. However, such rendering operations are complex and may not be supported.
For example, a small hand-held device such as a personal digital assistant (PDA) or a cell phone may have a small display. Sometimes the graphics data in the frame buffer may need to be quickly rotated after it has been written in. For example, the user may press a rotate-display button and then manually turn the PDA or cell phone by 90 or 270 degrees. The existing graphics data in the frame buffer then needs to be displayed in a rotated order from the frame buffer, which still stores the graphics data in the un-rotated order.
FIG. 2 shows pixel scan order for normal and rotated display modes. In FIG. 2A, the normal, un-rotated scan mode reads pixels from frame buffer 10 from the upper left. First pixel 00 is read and displayed, then pixels 01, 02, 03, 04 . . . 09 in the top line. Then the left-most pixel in the second line, pixel 10, is read and displayed, followed by other pixels 11, 12, 13, . . . in the second line. Then pixels 20, 21, 22, 23, . . . in the third line are read and displayed on a non-rotated display (not shown).
Reading of pixels from frame buffer 10 can be accelerated by using burst reads. Some memory devices allow for burst-access reads that are faster overall than many individual reads. Several pixels of data may be read out at about the same time using burst reads. For example, four pixels may be read in a burst, but only when these four pixels are in the same line and are located together in a group. Pixels 40, 41, 42, 43 may be read together as a burst-read, while pixels 44, 45, 46, 47 could be another burst read, etc. Other lines could also use burst reads, such as pixels 00, 01, 02, 03 in the top line, etc. Each line of 10 pixels requires only 3 burst reads, rather than 10 individual reads. Thus to read all 5 lines requires 5×3 or 15 burst reads.
In FIG. 2B, graphics data from frame buffer 10 is read out in rotated order and displayed on display 12 in rotated order. Pixels must be sent to display 12 in rotated-scan order from the top-left, starting with pixel 40. The first line displayed has pixels 40, 30, 20, 10, 00, which are the first column of pixels in frame buffer 10. Then the second line displayed has pixels 41, 31, 21, 11, 01, which is the second column from frame buffer 10.
Thus frame buffer 10 needs to be read column-wise from the bottom up, and then from left to right. This rotated scan order of reading frame buffer 10 is inefficient, since burst accesses cannot be used. Pixels must be delivered to display 12 exactly in the rotated scan order to be properly displayed. Since pixels 40, 30, 20, 10 are in different rows of frame buffer 10, they cannot be read together as a single burst access. Instead, four individual reads are required. Thus all pixels must be read individually. While un-rotated data can use just 15 burst-read accessed, 50 read accesses are needed for the rotated scan order.
The pixels from frame buffer 10 could be copied to an intermediate full-frame buffer and re-arranged into the rotated scan order so that burst-reads could be used. However, this wastes memory as two frame buffers are needed, and frame buffers can be large.
What is desired is an efficient way to read graphics data from a frame buffer when the data must be rotated before display. Rotating graphics data from an un-rotated frame buffer using a smaller buffer is desirable. A smaller buffer for use in rotating graphics data that is not a full-frame buffer is desirable.